package com.woniu.controller;

import com.woniu.entity.RbacManager;
import com.woniu.entity.ResponseEntity;
import com.woniu.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author:陈涵
 * @Do:登录用的Controller
 * @date: 2022/9/5 21:53
 */
@RestController
@CrossOrigin
public class LoginController {
        @Autowired
        LoginService loginService;
        @GetMapping("/login")
        public ResponseEntity login(String username, String password) throws Exception {

                return loginService.login(username,password);
        }
        @RequestMapping("/401")
        public ResponseEntity response401(){
                return ResponseEntity.AUTHFAILED;
        }

}
